package func.study.groovy.call;

import func.study.groovy.call.AGroovyClass;

/**
 * Created by yao_pc on 2017/8/4.
 */
public class UseGroovyClass {

    public static void main(String[] args) {
        //闭包调用
        AGroovyClass instance = new AGroovyClass();
        Object result = instance.useClosure(new Object() {
            public String call() {
                return "your called groovy";
            }
        });

        System.out.println(result);
        //闭包带参数调用
        Object result2 = instance.passToClosure(1, new Object() {
            public String call(int value) {
                return "your called groovy with value=" + value;
            }
        });
        System.out.println(result2);

    }


}
